{include file="public/layout"/}
<body class="bodystyle" style="min-width:auto;">
<div id="toolTipLayer" style="position: absolute; z-index: 9999; display: none; visibility: visible; left: 95px; top: 573px;"></div>
<div id="append_parent"></div>
<div id="ajaxwaitid"></div>
<div class="page min-hg-c-10" style="min-width:auto; ">
    <div class="flexigrid htitx">
        <form class="form-horizontal" id="handlepost1" method="post" enctype="multipart/form-data" action="{:url('Security/popup_adminbasefile')}">
            <div class="ncap-form-default">
                <dl class="row">
                    <dt class="tit">
                        <label for="adminbasefile"><em>*</em>登录路径</label>
                    </dt>
                    <dd class="opt" style="width: auto;">
                        __SITE_URL____ROOT_DIR__/<input type="hidden" name="adminbasefile_old" value="{$adminbasefile|default='login'}"><input id="adminbasefile" name="adminbasefile" value="{$adminbasefile|default='login'}" type="text" data-site_url="__SITE_URL__" onKeyUp="this.value=this.value.replace(/[^\w\_\-]/g,'');" onbeforepaste="clipboardData.setData('text',clipboardData.getData('text').replace(/[^\w\_\-]/g,''));" class="w200" autocomplete="off" />.php
                        <p class="notic2">为了提高系统的安全性，请更改后台入口文件，可使用英文字母大小写+数字。</p>
                    </dd>
                </dl>
                <dl class="row">
                    <div class="bot" style="padding-bottom:0px;">
                        <a href="JavaScript:void(0);" onclick="checkForm1();" class="ncap-btn-big ncap-btn-green">保存</a>
                    </div>
                </dl>
            </div>
        </form>
        
    </div>
</div>

<script type="text/javascript">
    var parentObj = parent.layer.getFrameIndex(window.name); //先得到当前iframe层的索引

    function checkForm1(){
        var adminbasefileObj = $('input[name=adminbasefile]');
        var adminbasefile_oldObj = $('input[name=adminbasefile_old]');
        if($.trim(adminbasefileObj.val()) == ''){
            showErrorMsg('后台路径不能为空！');
            adminbasefileObj.focus();
            return false;
        }
        
        if(adminbasefile_oldObj.val() != adminbasefileObj.val()){
            var flag = false;
            var site_url = adminbasefileObj.data('site_url');
            layer.confirm('后台路径：<font color="red">'+site_url+'__ROOT_DIR__/'+adminbasefileObj.val()+'.php</font>，确认更改？', {
                    title: false,
                    closeBtn: false,
                    btn: ['继续更改','取消'] //按钮
                }, function(){
                    layer_loading('正在处理');
                    setTimeout(function (){
                        $.ajax({
                            type : 'post',
                            url : "{:url('Security/popup_adminbasefile', ['_ajax'=>1])}",
                            data : $('#handlepost1').serialize(),
                            dataType : 'json',
                            success : function(res){
                                layer.closeAll();
                                if(res.code == 1){
                                    showSuccessMsg(res.msg, 500, function(){
                                        top.window.location.href = res.url;
                                    });
                                }else{
                                    showErrorMsg(res.msg);
                                }
                            },
                            error: function(e){
                                layer.closeAll();
                                showErrorAlert(e.responseText);
                            }
                        });
                    }, 1);
                }, function(index){
                    flag = false;
                }
            );
            return flag;
        }
        layer_loading('正在处理');
        setTimeout(function (){
            $.ajax({
                type : 'post',
                url : "{:url('Security/popup_adminbasefile', ['_ajax'=>1])}",
                data : $('#handlepost1').serialize(),
                dataType : 'json',
                success : function(res){
                    layer.closeAll();
                    if(res.code == 1){
                        var _parent = parent;
                        _parent.layer.close(parentObj);
                        _parent.layer.msg(res.msg, {shade: layer_shade, time: 500}, function(){
                            _parent.window.location.reload();
                        });
                    }else{
                        showErrorMsg(res.msg);
                    }
                },
                error: function(e){
                    layer.closeAll();
                    showErrorAlert(e.responseText);
                }
            });
        }, 1);
    }
</script>

{include file="public/footer" /}